﻿using Microsoft.AspNetCore.Mvc;
using Mojito.Services;
using System.Linq;
using System.Threading.Tasks;

namespace Mojito.Controllers
{
    /// <summary>
    ///  环境
    /// </summary>
    [Route("api/env")]
    public class EnviromentController : ControllerBase
    {
        public EnviromentService _EnviromentService { get; set; }

        /// <summary>
        ///  读取环境变量集
        /// </summary>
        /// <param name="workspaceId"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IActionResult> Get([FromQuery] string workspaceId)
        {
            var list = (await _EnviromentService.Get(workspaceId));
            return Success(data: list);
        }

        /// <summary>
        ///  新增 / 编辑
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IActionResult> Post()
        {
            return Success();
        }

        /// <summary>
        ///  删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete("{Id}")]
        public async Task<IActionResult> Delete(string Id)
        {
            return Success();
        }
    }
}
